﻿
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;


public class StaticDataReader
{
    public static List<T> LoadJsonFromFile<T>(string fileName)
    {
        TextAsset text = Resources.Load<TextAsset>("data/" + fileName);
        string json = text.text;
        if (string.IsNullOrEmpty(json)) return null;

        StaticDataItem<T> staticData = JsonUtility.FromJson<StaticDataItem<T>>(json);
        return staticData.rows;
    }

    [Serializable]
    private class StaticDataItem<T>
    {
        public List<T> rows;
    }
}
